package com.easy.dn.utils.exception;

/**
 * description 统一异常类
 * author zhanqiulin
 * create 2017/8/7
 */
public class ErrorException extends RuntimeException {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    /**
     * 错误码
     */
    private Integer code = 1;

    /**
     * 构造函数
     */
    public ErrorException(String message) {
        super(message);
    }

    /**
     * 构造函数
     */
    public ErrorException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    /**
     * description 抛异常
     * param
     * return
     */
    public static void error(Integer code, String message) {
        throw new ErrorException(code, message);
    }

    /**
     * 获取code
     */
    public Integer getCode() {
        return code;
    }

    /**
     * 设置code
     */
    public void setCode(Integer code) {
        this.code = code;
    }
}